Namespace - LJCNetCommon
Parameters
text - The text value.
beginDelimiter - The beginning delimiter.
beginIndex - The begin index.
endIndex - The end index.
startIndex - The starting index.
endDelimiter - The ending delimiter.
Returns
The string between the specified delimiters.
Syntax
C# |
public static String GetDelimitedAndIndexes(String text, String beginDelimiter, out Int32& beginIndex, out Int32& endIndex, Int32& startIndex, String endDelimiter = null)
|
Get the delimited string begin and end index.
Example
C# |
using LJCNetCommon;
private static void GetDelimitedAndIndexes()
{
var source = "<summary>This is some text.</summary>";
int startIndex = 0;
var beginDelimiter = "<summary>";
var endDelimiter = "</summary>";
var text = NetString.GetDelimitedAndIndexes(source, beginDelimiter
, out int beginIndex, out int endIndex, ref startIndex, endDelimiter);
source = "|This is some text.|";
startIndex = 0;
beginDelimiter = "|";
text = NetString.GetDelimitedAndIndexes(source, beginDelimiter
, out beginIndex, out endIndex, ref startIndex);
source = "|This is some text.";
startIndex = 0;
beginDelimiter = "|";
text = NetString.GetDelimitedAndIndexes(source, beginDelimiter
, out beginIndex, out endIndex, ref startIndex, "#NoDelimiter");
source = "|This is some text.| |and some more here.|";
startIndex = 0;
beginDelimiter = "|";
while (startIndex > -1)
{
text = NetString.GetDelimitedAndIndexes(source, beginDelimiter
, out beginIndex, out endIndex, ref startIndex);
}
}
|
Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.